Auto-focus refers to controlling a distance from a lens to an image sensor using an auto-focus algorithm such that a subject of a to-be-photographed object reaches a clearest state.
Commonly used focus algorithms may be classified into two types, active focusing (a distance measurement method) and passive focusing (a hill climbing method). In active focusing, a distance from a photographed subject to a lens is measured using a method such as infrared distance measurement, ultrasonic distance measurement, and binocular stereoscopic vision, a lens position corresponding to an object distance is calculated, and the lens position is adjusted to obtain an image in focus. In passive focusing, images with different focal lengths are obtained by changing focal lengths, definition and change trends of the images are analyzed, an optimal focal length is found, to obtain an image in focus. Currently, a passive focusing solution is widely used in an electronic device such as a smartphone.
A speed of active focusing is fast, but in a specific scenario, a focusing failure rate is high. Precision of passive focusing is high, but a focusing speed is slow.